<template>
	<div>
    <div class="layer_top">
      <div class="name-area"><span class="names">用户姓名：</span>{{ dataBus.userName }}</div>
      <div class="name-area"><span class="names">户主关系：</span>{{ dataBus.householdRoleText }}</div>
      <div class="name-area"><span class="names">性别：</span>{{ dataBus.gender }}</div>
      <div class="name-area"><span class="names">身份证号：</span>{{ dataBus.idCardNo }}</div>
      <div class="name-area"><span class="names">联系电话：</span>{{ dataBus.userMobile }}</div>
      <div class="name-area"><span class="names">村民编号：</span>{{ dataBus.unionCertNo }}</div>
      <div class="name-area"><span class="names">住址：</span>{{ dataBus.homeAddress }}</div>
      <div class="name-area"><span class="names">房号：</span>{{ dataBus.roomNumber }}</div>
      <div class="name-area"><span class="names">审核状态：</span><Tag>{{ dataBus.authText }}</Tag></div>
    </div>
    <div class="idCardNo">
      <Row type="flex" justify="center">
        <Col span="12"><img :src="dataBus.idCardFront" alt="身份证正面"><br>身份证正面</Col>
        <Col span="12"><img :src="dataBus.idCardBack" alt="身份证反面"><br>身份证反而</Col>
      </Row>
    </div>
    <footer>
      <Button v-if="dataBus.authStatus === 1" type="primary" @click="Submit">通过</Button>
      <Button v-if="dataBus.authStatus === 1" type="default" @click="Reject">驳回</Button>
    </footer>
  </div>  
</template>

<script scope>
export default {
  props: {
    dataBus: Object,
    callbank: Function
  },
  data () {
    return {
      showSubmit: false
    }
  },
  methods: {
    Init() {
      
    },
    Submit() {
      this.$Modal.confirm({
        title: '温馨提示',
        content: '确认审核通过？',
        onOk: ()=> {
          new this.$rest({
            gateway: 'agrobiz',
            service: "agrobiz-uc",
            url: "/v1.0/household-src/villager/audit",
            data: {
              pojo: {
                villagerId: this.dataBus.villagerId,
                countyCode: this.dataBus.countyCode,
                authStatus: 2
              }
            },
            action: (res) => {
              if (res.data.code === 20000) {
                this.$Message.success({
                  content: '审核成功',
                  duration: 1,
                  onClose: ()=> {
                    this.callbank()
                  }
                })
              } else {
                this.$Notice.warning({
                  desc: `失败原因：${res.data.msg}`,
                });
              }
            },
          }).post()
        }
      })
      
    },
    Reject() {
      this.$Modal.confirm({
        title: '温馨提示',
        content: '确认驳回',
        onOk: ()=> {
          new this.$rest({
            gateway: 'agrobiz',
            service: "agrobiz-uc",
            url: "/v1.0/household-src/villager/audit",
            data: {
              pojo: {
                villagerId: this.dataBus.villagerId,
                countyCode: this.dataBus.countyCode,
                authStatus: 3
              }
            },
            action: (res) => {
              if (res.data.code === 20000) {
                this.$Message.success({
                  content: '驳回成功',
                  duration: 1,
                  onClose: ()=> {
                    this.callbank()
                  }
                })
              } else {
                this.$Notice.warning({
                  desc: `失败原因：${res.data.msg}`,
                });
              }
            },
          }).post()
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>
.layer_top {
  display: flex; flex-wrap: wrap;
}
.name-area {
  padding: 3px 0; width: 33%;
}
.names {
  width: 100px; font-weight: 800; display: inline-block;
}
.idCardNo {
  text-align: center;
}
.idCardNo img {
  width: 60%;
}
footer {
  text-align: center; margin: 15px auto;
}
</style>